package com.util;

import com.controller.TestController;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: create by God of SJF
 * @version: v1.0
 * @description: com.util
 * @date:2021/9/23
 */
public class 获取文件名字 {


    public static void main(String[] args)throws Exception {
        File[] fileList = new File("/Users/libin/Desktop/分类2-切割/").listFiles();
        File insert = new File("/Users/libin/Desktop/分类2-切割/insert");
        String sql = "INSERT INTO `stock_dictionaries`.`_stock_handle`( `_file_name`, `_status`) VALUES ('NAME', 0);";
        List<String> list = new ArrayList<String>();
        for (File file : fileList) {
            String name = file.getName();
            String thisSQL = sql.replaceAll("NAME",name)+"\r\n";
            list.add(thisSQL);
        }
        TestController.writeFile(insert.getAbsolutePath(),list);
    }
}
